import { request, config } from 'utils'
import * as commonService from "utils/services";

const { api } = config;
const { financialRecharge, financialPay,lwjRecharge,financialReceipt ,distributor} = api;

export async function query(params = {}) {
  params.apiBaseUrl = `${financialRecharge}`;
  return commonService.commonQuery(params);
}
export async function queryTenant(params = {}) {
  params.apiBaseUrl = `${financialReceipt}/recharge`;
  return commonService.commonQuery(params);
}
export async function createLog(payload = {}) {
  console.info(payload)
  return request({
    url: `${financialRecharge}/create`, method: 'POST', data: {
      ...payload
    }
  })
}
export async function recharge(payload = {}) {
  return request({
    url: `${financialPay}/getRechargeReceiptPath`, method: 'PUT', data: {
      ...payload
    }
  })
}
export async function accumulated(payload = {}) {
  console.info(payload)
  return request({
    url: `${financialRecharge}/accumulated/${payload.chargeType}`, method: 'GET'
  })
}
export async function createBillRecord(payload = {}) {
  return request({
    url: `${lwjRecharge}/createBillRecord`, method: 'PUT',data:{...payload}
  })
}

export async function filterDistributor(payload = {}) {
  return request({
    url: `${distributor}/${payload.distributor.id}/search`, method: 'POST'
  })
}
